<{use class="frontend\assets\FancyBoxAsset"}>
<{FancyBoxAsset::register($this)|void}>
<{use class="frontend\assets\SwiperAsset"}>
<{SwiperAsset::register($this)|void}>


<div class="content margin_top">
        <header class="header fixed_top bg_mx_green"></header>
        <div class="swipe">
            <div class='swipe-wrap'></div>
            <ul class="position"></ul>
        </div>
        <div class="detail light"></div>
    </div>
    <script type="text/template" charset="utf-8" id='swipe_template'></script>
    <script type="text/template" charset="utf-8" id='detail_template'>
        <div class="bg_white margin_b_10">
            <div class="row border_b padding_10_15">
                <div class="col_12">{{=it.title}}</div>
            </div>
            <div class="row border_b padding_10_15">
                <div class="col_6 warning">编号:{{=it.number}}</div>
            </div>
            <div class="row padding_10_15">
                <div class="col_12">批次：{{=it.batch}}</div>
                <div class="col_12">猪种：{{=it.type}}</div>
                <div class="col_12">入栏日期：{{=it.intime}}</div>
                <div class="col_12">养殖户：<a href="/shop/site/livery-detail?id={{=it.fid}}">{{=it.operator}}</a></div>
                <div class="col_12">巡检员：<a href="/shop/site/person-detail?id={{=it.pid}}">{{=it.owner}}</a></div>
                <div class="col_12">预出栏日期：{{=it.planout}}</div>
            </div>
        </div>


        <{if $checkperson }>
        <div class="bg_white margin_b_10">
            <div class="row border_b padding_10_15">
                <div class="col_12">
                    <a href="/business/person/new-put-inspection?pigid=<{$pigid}>" class="col_4 btn btn_danger" style="text-align:center;margin-left: 30%;">开始巡检</a>
                </div>
            </div>
        </div>
        <{/if}>

        <div class="bg_white lineheight_4">
            <div class="arrow_down padding_h_15 border_b from_nav">档案<?=$checkperson?></div>
            <div class="padding_15 font_12 row hide">
                <div class="pull_left padding_r_10 col_12">猪场合同编号：{{=it.contract_no}}</div>
                <!--<div class="pull_left padding_r_10 col_12">猪场：{{=it.slaughterhouse}}</div>-->
                <div class="pull_left col_12">批次：{{=it.batch}}</div>
                <div class="pull_left col_12">代养地址：{{=it.address}}</div>
                <div class="pull_left flex_row_2">
                    <div class="row_one">
                        <div class="">父本编号:{{=it.f_no}}</div>
                        <a href="{{=it.f_img}}" rel="fm" class="fancybox"><img src="{{=it.f_img}}" alt=""></a>
                    </div>
                    <div class="row_one">
                        <div class="">母本编号:{{=it.m_no}}</div>
                        <a href="{{=it.m_img}}" rel="fm"  class="fancybox"><img src="{{=it.m_img}}" alt=""></a>
                    </div>
                </div>
            </div>
            <div class="arrow_down padding_h_15 border_b from_nav">生长环境</div>
            <div class="padding_15 flex_row_4" style="display:none">
                {{for(var i=0;i<it.surroundings.length;i++){}}
                <div class="row_one surrounding_img">
                    <a href="{{=it.surroundings[i]}}" rel="env" class="fancybox"><img src="{{=it.surroundings[i]}}" alt="" height="100%"></a>
                </div>
                {{}}}
            </div>
            <div class="arrow_down padding_h_15 border_b from_nav">巡检记录</div>
            <div class="padding_15 font_12 light hide">
                {{for(var i=0;i<it.records.length;i++){}}
                <div class="h_justify" onclick="location.href='{{=it.records[i].url}}'">
                    <div>{{=it.records[i].title}}</div>
                    <div>第{{=it.records[i].no}}次巡检</div>
                    <div>巡检人：{{=it.records[i].who}}</div>
                </div>
                {{}}}
            </div>
            <div class="arrow_down padding_h_15 border_b from_nav">小视频</div>
            <div class="padding_15 font_12 light hide">
                <{foreach $pig['video'] as $key => $row}>
                <{if $row != '/static/images/noimage.jpg'}>
                    <div class="pigvideo">
                        <video style="margin-bottom: 20px;" id="example_video_1" class="video-js vjs-default-skin vjs-big-play-centered" controls preload="auto" width="100%" height="240" poster="http://video-js.zencoder.com/oceans-clip.png" data-setup='{"example_option":true}'>
                            <source src="<{$row}>" type='video/mp4' />
                            <p class="vjs-no-js">您的手机不支持视频播放，请升级浏览器 <a href="http://videojs.com/html5-video-support/" target="_blank">支持Html5video</a></p>
                        </video>
                    </div>
                <{else}>
                    <div>小视频正在路上。。。。。</div>
                <{/if}>
                <{/foreach}>
            </div>
            <div class="arrow_down padding_h_15 border_b from_nav">宰杀后流程</div>
            <div class="padding_15 font_12 light hide">
                <div class="pigvideo">
                    <div><{$pig['slaughter']}></div>
                </div>
            </div>
            <!--<div class="arrow_down padding_h_15 from_nav">二维码</div>-->
            <!--<div class="text_center hide">-->
                <!--<img class="width_200" src="<{url route='/site/qrcode' pigno=$pigno}>" alt="">-->
            <!--</div>-->
        </div>
    </script>
    <script>
        // 轮播模版
            //var banner = ["/static/images/from.jpg","/static/images/pig1.jpg","/static/images/pig2.jpg"]
            var banner = <{$banner}>;
            loadswipe(banner)
        // 详情模版
            var detail = {id:"1",title:"第28-2期黑山猪散养",number:"柞A20160713245123",type:"秦岭黑猪007号",period:"12个月",operator:"张在行",owner:"王欢",contract_no:"1431251351",slaughterhouse:"三元土猪场",no:"No1253",address:"陕西省商洛市柞水县盘龙镇张家村二组3号",f_no:"546411323455",f_img:"/static/images/from_f.jpg",m_no:"546411323315",m_img:"/static/images/from_m.jpg",surroundings:["/static/images/farmer_img.jpg","/static/images/list1.jpg","/static/images/list2.jpg","/static/images/pig.jpg","/static/images/farmer_img.jpg","/static/images/list1.jpg","/static/images/list2.jpg","/static/images/pig.jpg"],records:[{title:"巡检标题(2017-06-11)",no:"4",who:"王小二"},{title:"巡检标题(2017-05-25)",no:"3",who:"王小二"},{title:"巡检标题(2017-05-18)",no:"2",who:"王小二"},{title:"巡检标题(2017-05-12)",no:"1",who:"王小二"}],qrcode:"/static/images/qrcode.jpg"};
            var detail = <{$detail}>;
            var evaldetail = doT.template($("#detail_template").text());
            loaddata(".detail",evaldetail,detail)
            $(".surrounding_img").css("height",(($(window).width()-45)*0.7/4)+"px")
        // 详情项打开关闭特效
            $(".from_nav").click(function(){
                $(this).toggleClass("arrow_down arrow_up").next().toggle()
            })
        // 页面初始化：头部
            loadheadbar("猪肉溯源");



            //点击预览图片
            $('.fancybox').fancybox({
                'titlePosition' : 'over',
                'cyclic'        : true,
                'height':500
            });
    </script>


